<template>
    <div class="list">
        <h2>
            <slot></slot>
        </h2>
        <ul>
            <li v-for="(item,index) in list" :key="item.id" >
                <input type="checkbox" v-model="item.flag" @change.stop="$emit('changStatus',{status:item.flag,index:index})">
                <p>{{item.title}}</p>
                <button class="btn" @click="$emit('delet',index)">删除</button>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    props:{
        list:Array
    }
    
}
</script>

<style lang="scss" scoped>
.list{
    padding-top: 40px;
    width: 100%;
    box-sizing: border-box;
    h2{
        margin-bottom: 20px;
        width: 600px;
        margin: 0 auto;
    }
    ul{
        width: 600px;
        margin: 0 auto;
        li{
            display: flex;
            width: 600px;
            height: 30px;
            align-items: center;
            padding: 0 16px;
            justify-content: space-between;
            box-sizing: border-box;
            //background-color: #eee;
            border-radius: 6px;
            margin:10px 0;
            p{
                flex: 1;
                margin-left: 20px;
            }
            .btn{
                border: 0;
            }
        }
    }
}
</style>
